package com.xiaoma.chat.domain;

import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.xiaoma.chat.resource.Organization;

public class User {

    private Integer id;
    private String imUserId;
    private String name;
    private String nickname;
    private String portraitUri;
    private String token;
    private Integer organizationId;
    private Date createdAt;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getImUserId() {
		return imUserId;
	}
	public void setImUserId(String imUserId) {
		this.imUserId = imUserId;
	}
	public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getNickname() {
        return nickname;
    }
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    public String getPortraitUri() {
        return portraitUri;
    }
    public void setPortraitUri(String portraitUri) {
        this.portraitUri = portraitUri;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public Integer getOrganizationId() {
        return organizationId;
    }
    public void setOrganizationId(Integer organizationId) {
        this.organizationId = organizationId;
    }
    public Date getCreatedAt() {
        return createdAt;
    }
    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }
    
    public boolean validate() {
        return StringUtils.isNotEmpty(this.name) && (null != this.organizationId) && (Organization.isExist(this.organizationId));
    }
    
}
